package com.asman.worker.gallery

import android.os.Parcel
import android.os.Parcelable
import androidx.annotation.Keep

/**
 * Created by Darshan on 4/18/2015.
 */
@Keep
data class Image(
    var id: Long = 0,
    var name: String? = null,
    var path: String? = null,
    var size: String? = null,
    var duration: String? = "0"
) : Parcelable {
    constructor(source: Parcel) : this(
        source.readLong(),
        source.readString(),
        source.readString(),
        source.readString(),
        source.readString()
    )

    override fun describeContents() = 0

    override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
        writeLong(id)
        writeString(name)
        writeString(path)
        writeString(size)
        writeString(duration)
    }

    companion object {
        @JvmField
        val CREATOR: Parcelable.Creator<Image> = object : Parcelable.Creator<Image> {
            override fun createFromParcel(source: Parcel): Image = Image(source)
            override fun newArray(size: Int): Array<Image?> = arrayOfNulls(size)
        }
    }
}